# coding: utf-8

"""
    Selling Partner API for Listings Items

    The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API.  For more information, see the [Listings Items API Use Case Guide](https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2021-08-01-use-case-guide).

    The version of the OpenAPI document: 2021-08-01
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from spapi.api_client import ApiClient


class ListingsApi(object):
    """NOTE: This class is auto generated by the openapi generator.

    Do not edit the class manually.
    """

    api_models_module = "spapi.models.listings_items_v2021_08_01"

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.classFileName = 'listings_api'

    def delete_listings_item(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """delete_listings_item  # noqa: E501

        Delete a listings item for a selling partner.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 5 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_listings_item(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
            return data

    def delete_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """delete_listings_item  # noqa: E501

        Delete a listings item for a selling partner.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 5 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_listings_item_with_http_info(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['seller_id', 'sku', 'marketplace_ids', 'issue_locale']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_listings_item" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'seller_id' is set
        if self.api_client.client_side_validation and ('seller_id' not in params or
                                                       params['seller_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `seller_id` when calling `delete_listings_item`")  # noqa: E501
        # verify the required parameter 'sku' is set
        if self.api_client.client_side_validation and ('sku' not in params or
                                                       params['sku'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `sku` when calling `delete_listings_item`")  # noqa: E501
        # verify the required parameter 'marketplace_ids' is set
        if self.api_client.client_side_validation and ('marketplace_ids' not in params or
                                                       params['marketplace_ids'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `marketplace_ids` when calling `delete_listings_item`")  # noqa: E501

        if self.api_client.client_side_validation and ('marketplace_ids' in params and
                                            len(params['marketplace_ids']) > 1):
            raise ValueError("Invalid value for parameter `marketplace_ids` when calling `delete_listings_item`, number of items must be less than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ListingsItemSubmissionResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats, api_models_module=self.api_models_module)

    def get_listings_item(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """get_listings_item  # noqa: E501

        Returns details about a listings item for a selling partner.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_listings_item(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :param List[str] included_data: A comma-delimited list of data sets to include in the response. Default: `summaries`.
        :return: Item
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
        else:
            (data) = self.get_listings_item_with_http_info(seller_id, sku, marketplace_ids, **kwargs)  # noqa: E501
            return data

    def get_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, **kwargs):  # noqa: E501
        """get_listings_item  # noqa: E501

        Returns details about a listings item for a selling partner.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_listings_item_with_http_info(seller_id, sku, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :param List[str] included_data: A comma-delimited list of data sets to include in the response. Default: `summaries`.
        :return: Item
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['seller_id', 'sku', 'marketplace_ids', 'issue_locale', 'included_data']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_listings_item" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'seller_id' is set
        if self.api_client.client_side_validation and ('seller_id' not in params or
                                                       params['seller_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `seller_id` when calling `get_listings_item`")  # noqa: E501
        # verify the required parameter 'sku' is set
        if self.api_client.client_side_validation and ('sku' not in params or
                                                       params['sku'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `sku` when calling `get_listings_item`")  # noqa: E501
        # verify the required parameter 'marketplace_ids' is set
        if self.api_client.client_side_validation and ('marketplace_ids' not in params or
                                                       params['marketplace_ids'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `marketplace_ids` when calling `get_listings_item`")  # noqa: E501

        if self.api_client.client_side_validation and ('marketplace_ids' in params and
                                            len(params['marketplace_ids']) > 1):
            raise ValueError("Invalid value for parameter `marketplace_ids` when calling `get_listings_item`, number of items must be less than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501
        if 'included_data' in params:
            query_params.append(('includedData', params['included_data']))  # noqa: E501
            collection_formats['includedData'] = 'csv'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Item',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats, api_models_module=self.api_models_module)

    def patch_listings_item(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """patch_listings_item  # noqa: E501

        Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 5 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.patch_listings_item(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPatchRequest body: The request body schema for the `patchListingsItem` operation. (required)
        :param List[str] included_data: A comma-delimited list of data sets to include in the response. Default: `issues`.
        :param str mode: The mode of operation for the request.
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.patch_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
        else:
            (data) = self.patch_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
            return data

    def patch_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """patch_listings_item  # noqa: E501

        Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 5 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.patch_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPatchRequest body: The request body schema for the `patchListingsItem` operation. (required)
        :param List[str] included_data: A comma-delimited list of data sets to include in the response. Default: `issues`.
        :param str mode: The mode of operation for the request.
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['seller_id', 'sku', 'marketplace_ids', 'body', 'included_data', 'mode', 'issue_locale']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method patch_listings_item" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'seller_id' is set
        if self.api_client.client_side_validation and ('seller_id' not in params or
                                                       params['seller_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `seller_id` when calling `patch_listings_item`")  # noqa: E501
        # verify the required parameter 'sku' is set
        if self.api_client.client_side_validation and ('sku' not in params or
                                                       params['sku'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `sku` when calling `patch_listings_item`")  # noqa: E501
        # verify the required parameter 'marketplace_ids' is set
        if self.api_client.client_side_validation and ('marketplace_ids' not in params or
                                                       params['marketplace_ids'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `marketplace_ids` when calling `patch_listings_item`")  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and ('body' not in params or
                                                       params['body'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `body` when calling `patch_listings_item`")  # noqa: E501

        if self.api_client.client_side_validation and ('marketplace_ids' in params and
                                            len(params['marketplace_ids']) > 1):
            raise ValueError("Invalid value for parameter `marketplace_ids` when calling `patch_listings_item`, number of items must be less than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'included_data' in params:
            query_params.append(('includedData', params['included_data']))  # noqa: E501
            collection_formats['includedData'] = 'csv'  # noqa: E501
        if 'mode' in params:
            query_params.append(('mode', params['mode']))  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ListingsItemSubmissionResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats, api_models_module=self.api_models_module)

    def put_listings_item(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """put_listings_item  # noqa: E501

        Creates a new or fully-updates an existing listings item for a selling partner.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.put_listings_item(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPutRequest body: The request body schema for the `putListingsItem` operation. (required)
        :param List[str] included_data: A comma-delimited list of data sets to include in the response. Default: `issues`.
        :param str mode: The mode of operation for the request.
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.put_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
        else:
            (data) = self.put_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, **kwargs)  # noqa: E501
            return data

    def put_listings_item_with_http_info(self, seller_id, sku, marketplace_ids, body, **kwargs):  # noqa: E501
        """put_listings_item  # noqa: E501

        Creates a new or fully-updates an existing listings item for a selling partner.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The preceding table indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput can receive higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api) in the Selling Partner API documentation.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.put_listings_item_with_http_info(seller_id, sku, marketplace_ids, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param str sku: A selling partner provided identifier for an Amazon listing. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param ListingsItemPutRequest body: The request body schema for the `putListingsItem` operation. (required)
        :param List[str] included_data: A comma-delimited list of data sets to include in the response. Default: `issues`.
        :param str mode: The mode of operation for the request.
        :param str issue_locale: A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: `en_US`, `fr_CA`, `fr_FR`. Localized messages default to `en_US` when a localization is not available in the specified locale.
        :return: ListingsItemSubmissionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['seller_id', 'sku', 'marketplace_ids', 'body', 'included_data', 'mode', 'issue_locale']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method put_listings_item" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'seller_id' is set
        if self.api_client.client_side_validation and ('seller_id' not in params or
                                                       params['seller_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `seller_id` when calling `put_listings_item`")  # noqa: E501
        # verify the required parameter 'sku' is set
        if self.api_client.client_side_validation and ('sku' not in params or
                                                       params['sku'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `sku` when calling `put_listings_item`")  # noqa: E501
        # verify the required parameter 'marketplace_ids' is set
        if self.api_client.client_side_validation and ('marketplace_ids' not in params or
                                                       params['marketplace_ids'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `marketplace_ids` when calling `put_listings_item`")  # noqa: E501
        # verify the required parameter 'body' is set
        if self.api_client.client_side_validation and ('body' not in params or
                                                       params['body'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `body` when calling `put_listings_item`")  # noqa: E501

        if self.api_client.client_side_validation and ('marketplace_ids' in params and
                                            len(params['marketplace_ids']) > 1):
            raise ValueError("Invalid value for parameter `marketplace_ids` when calling `put_listings_item`, number of items must be less than or equal to `1`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501
        if 'sku' in params:
            path_params['sku'] = params['sku']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'included_data' in params:
            query_params.append(('includedData', params['included_data']))  # noqa: E501
            collection_formats['includedData'] = 'csv'  # noqa: E501
        if 'mode' in params:
            query_params.append(('mode', params['mode']))  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/listings/2021-08-01/items/{sellerId}/{sku}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ListingsItemSubmissionResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats, api_models_module=self.api_models_module)

    def search_listings_items(self, seller_id, marketplace_ids, **kwargs):  # noqa: E501
        """search_listings_items  # noqa: E501

        Search for and return a list of selling partner listings items and their respective details.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 5 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that are applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_listings_items(seller_id, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale that is used to localize issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". When a localization is not available in the specified locale, localized messages default to \"en_US\".
        :param List[str] included_data: A comma-delimited list of datasets that you want to include in the response. Default: `summaries`.
        :param List[str] identifiers: A comma-delimited list of product identifiers that you can use to search for listings items.   **Note**:  1. This is required when you specify `identifiersType`. 2. You cannot use 'identifiers' if you specify `variationParentSku` or `packageHierarchySku`.
        :param str identifiers_type: A type of product identifiers that you can use to search for listings items.   **Note**:  This is required when `identifiers` is provided.
        :param str variation_parent_sku: Filters results to include listing items that are variation children of the specified SKU.   **Note**: You cannot use `variationParentSku` if you include `identifiers` or `packageHierarchySku` in your request.
        :param str package_hierarchy_sku: Filter results to include listing items that contain or are contained by the specified SKU.   **Note**: You cannot use `packageHierarchySku` if you include `identifiers` or `variationParentSku` in your request.
        :param datetime created_after: A date-time that is used to filter listing items. The response includes listings items that were created at or after this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param datetime created_before: A date-time that is used to filter listing items. The response includes listings items that were created at or before this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param datetime last_updated_after: A date-time that is used to filter listing items. The response includes listings items that were last updated at or after this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param datetime last_updated_before: A date-time that is used to filter listing items. The response includes listings items that were last updated at or before this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param List[str] with_issue_severity: Filter results to include only listing items that have issues that match one or more of the specified severity levels.
        :param List[str] with_status: Filter results to include only listing items that have the specified status.
        :param List[str] without_status: Filter results to include only listing items that don't contain the specified statuses.
        :param str sort_by: An attribute by which to sort the returned listing items.
        :param str sort_order: The order in which to sort the result items.
        :param int page_size: The number of results that you want to include on each page.
        :param str page_token: A token that you can use to fetch a specific page when there are multiple pages of results.
        :return: ItemSearchResults
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.search_listings_items_with_http_info(seller_id, marketplace_ids, **kwargs)  # noqa: E501
        else:
            (data) = self.search_listings_items_with_http_info(seller_id, marketplace_ids, **kwargs)  # noqa: E501
            return data

    def search_listings_items_with_http_info(self, seller_id, marketplace_ids, **kwargs):  # noqa: E501
        """search_listings_items  # noqa: E501

        Search for and return a list of selling partner listings items and their respective details.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 5 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that are applied to the requested operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.search_listings_items_with_http_info(seller_id, marketplace_ids, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str seller_id: A selling partner identifier, such as a merchant account or vendor code. (required)
        :param List[str] marketplace_ids: A comma-delimited list of Amazon marketplace identifiers for the request. (required)
        :param str issue_locale: A locale that is used to localize issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". When a localization is not available in the specified locale, localized messages default to \"en_US\".
        :param List[str] included_data: A comma-delimited list of datasets that you want to include in the response. Default: `summaries`.
        :param List[str] identifiers: A comma-delimited list of product identifiers that you can use to search for listings items.   **Note**:  1. This is required when you specify `identifiersType`. 2. You cannot use 'identifiers' if you specify `variationParentSku` or `packageHierarchySku`.
        :param str identifiers_type: A type of product identifiers that you can use to search for listings items.   **Note**:  This is required when `identifiers` is provided.
        :param str variation_parent_sku: Filters results to include listing items that are variation children of the specified SKU.   **Note**: You cannot use `variationParentSku` if you include `identifiers` or `packageHierarchySku` in your request.
        :param str package_hierarchy_sku: Filter results to include listing items that contain or are contained by the specified SKU.   **Note**: You cannot use `packageHierarchySku` if you include `identifiers` or `variationParentSku` in your request.
        :param datetime created_after: A date-time that is used to filter listing items. The response includes listings items that were created at or after this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param datetime created_before: A date-time that is used to filter listing items. The response includes listings items that were created at or before this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param datetime last_updated_after: A date-time that is used to filter listing items. The response includes listings items that were last updated at or after this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param datetime last_updated_before: A date-time that is used to filter listing items. The response includes listings items that were last updated at or before this time. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
        :param List[str] with_issue_severity: Filter results to include only listing items that have issues that match one or more of the specified severity levels.
        :param List[str] with_status: Filter results to include only listing items that have the specified status.
        :param List[str] without_status: Filter results to include only listing items that don't contain the specified statuses.
        :param str sort_by: An attribute by which to sort the returned listing items.
        :param str sort_order: The order in which to sort the result items.
        :param int page_size: The number of results that you want to include on each page.
        :param str page_token: A token that you can use to fetch a specific page when there are multiple pages of results.
        :return: ItemSearchResults
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['seller_id', 'marketplace_ids', 'issue_locale', 'included_data', 'identifiers', 'identifiers_type', 'variation_parent_sku', 'package_hierarchy_sku', 'created_after', 'created_before', 'last_updated_after', 'last_updated_before', 'with_issue_severity', 'with_status', 'without_status', 'sort_by', 'sort_order', 'page_size', 'page_token']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method search_listings_items" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'seller_id' is set
        if self.api_client.client_side_validation and ('seller_id' not in params or
                                                       params['seller_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `seller_id` when calling `search_listings_items`")  # noqa: E501
        # verify the required parameter 'marketplace_ids' is set
        if self.api_client.client_side_validation and ('marketplace_ids' not in params or
                                                       params['marketplace_ids'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `marketplace_ids` when calling `search_listings_items`")  # noqa: E501

        if self.api_client.client_side_validation and ('marketplace_ids' in params and
                                            len(params['marketplace_ids']) > 1):
            raise ValueError("Invalid value for parameter `marketplace_ids` when calling `search_listings_items`, number of items must be less than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and ('identifiers' in params and
                                            len(params['identifiers']) > 20):
            raise ValueError("Invalid value for parameter `identifiers` when calling `search_listings_items`, number of items must be less than or equal to `20`")  # noqa: E501
        if self.api_client.client_side_validation and ('page_size' in params and params['page_size'] > 20):  # noqa: E501
            raise ValueError("Invalid value for parameter `page_size` when calling `search_listings_items`, must be a value less than or equal to `20`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'seller_id' in params:
            path_params['sellerId'] = params['seller_id']  # noqa: E501

        query_params = []
        if 'marketplace_ids' in params:
            query_params.append(('marketplaceIds', params['marketplace_ids']))  # noqa: E501
            collection_formats['marketplaceIds'] = 'csv'  # noqa: E501
        if 'issue_locale' in params:
            query_params.append(('issueLocale', params['issue_locale']))  # noqa: E501
        if 'included_data' in params:
            query_params.append(('includedData', params['included_data']))  # noqa: E501
            collection_formats['includedData'] = 'csv'  # noqa: E501
        if 'identifiers' in params:
            query_params.append(('identifiers', params['identifiers']))  # noqa: E501
            collection_formats['identifiers'] = 'csv'  # noqa: E501
        if 'identifiers_type' in params:
            query_params.append(('identifiersType', params['identifiers_type']))  # noqa: E501
        if 'variation_parent_sku' in params:
            query_params.append(('variationParentSku', params['variation_parent_sku']))  # noqa: E501
        if 'package_hierarchy_sku' in params:
            query_params.append(('packageHierarchySku', params['package_hierarchy_sku']))  # noqa: E501
        if 'created_after' in params:
            query_params.append(('createdAfter', params['created_after']))  # noqa: E501
        if 'created_before' in params:
            query_params.append(('createdBefore', params['created_before']))  # noqa: E501
        if 'last_updated_after' in params:
            query_params.append(('lastUpdatedAfter', params['last_updated_after']))  # noqa: E501
        if 'last_updated_before' in params:
            query_params.append(('lastUpdatedBefore', params['last_updated_before']))  # noqa: E501
        if 'with_issue_severity' in params:
            query_params.append(('withIssueSeverity', params['with_issue_severity']))  # noqa: E501
            collection_formats['withIssueSeverity'] = 'csv'  # noqa: E501
        if 'with_status' in params:
            query_params.append(('withStatus', params['with_status']))  # noqa: E501
            collection_formats['withStatus'] = 'csv'  # noqa: E501
        if 'without_status' in params:
            query_params.append(('withoutStatus', params['without_status']))  # noqa: E501
            collection_formats['withoutStatus'] = 'csv'  # noqa: E501
        if 'sort_by' in params:
            query_params.append(('sortBy', params['sort_by']))  # noqa: E501
        if 'sort_order' in params:
            query_params.append(('sortOrder', params['sort_order']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('pageSize', params['page_size']))  # noqa: E501
        if 'page_token' in params:
            query_params.append(('pageToken', params['page_token']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/listings/2021-08-01/items/{sellerId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ItemSearchResults',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats, api_models_module=self.api_models_module)
